package com.he.DesignPatterns.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: TODO
 * @Author: HCL
 * @Date: 2024/9/4 11:33
 */
public class StudentAggregateImpl implements StudentAggregate {

    private List<Student> studentList = new ArrayList<>();

    @Override
    public void addStudent(Student stu) {
        studentList.add(stu);
    }

    @Override
    public void removeStudent(Student stu) {
        studentList.remove(stu);
    }

    @Override
    public StudentIterator getStudentIterator() {
        return new StudentIteratorImpl(studentList);
    }
}
